{layout name="layout" /}

<div class="Hui-article">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-category-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>栏目名称：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <input type="text" class="input-text" value="" placeholder="请填写栏目名称" id="name" name="name">
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>上级栏目：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <span class="select-box">
                        <select class="select" id="sel_Sub" name="pid">
                            <option value="0">--请选择分类--</option>
                            {foreach $top as $key=>$val}
                            <option value="{$key}">{$val}</option>
                            {/foreach}
                        </select>
                    </span>
                    <span class="c-red">(不选则新增顶级栏目)</span>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>栏目类型(内容模板)：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <span class="select-box">
                        <select class="select" id="sel_Sub" name="type">
                                <option value="0">--请选择栏目模板--</option>
                            {//foreach $tpl_id as $key=>$val}
                            <option value="{//$key}">--{//$val}--</option>
                            {///foreach}
                        </select>
                    </span>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">排序</label>
                <div class="formControls col-xs-8 col-sm-1">
                    <input type="text" class="input-text" value="" name="sort" style="width:60px;">
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">描述：</label>
                <div class="formControls col-xs-8 col-sm-5">
                    <textarea name="description" cols="" rows="" class="textarea" placeholder="说点什么...最多输入100个字符" datatype="*10-100" dragonfly="true"
                        nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)"></textarea>
                    <p class="textarea-numberbar">
                        <em class="textarea-length">0</em>/200</p>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-success radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                    <input class="btn btn-default radius" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;" onclick="window.history.back();">
                </div>
            </div>
        </form>
    </article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    $(function () {
        $("#form-category-add").submit(function () {
            var note = $("#description").val();

            if (!$("#name").val()) {
                layer.msg('栏目名不能为空!', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }

            if (getblen(note) > 200) {
                layer.msg('备注过长', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
        })
    });
</script>
<!--请在上方写此页面业务相关的脚本-->